// FSession.cpp (c) 2011 JV Software
//

#include "EnginePrivate.h"

FSession			session;
Game				*game;

/*
============
FSession::Init
============
*/
void FSession::Init( void ) {
	engine->Printf(TEXT("Init Session...\n") );

	// Load the game DLL
	gameModule = sys->LoadModule( TEXT("Game.dll") );
	if(!gameModule) {
		engine->FatalError( TEXT( "Failed to load the game dll. \n" ) );
	}

	// Get the game API export function.
	getGameAPI = (GameAPI_t)gameModule->GetProcAddress( TEXT("GetGameAPI") );
	if(getGameAPI == NULL) {
		engine->FatalError( TEXT( "Failed to get the game dll entry point. \n" ) );
	}

	// Get the game class.
	game = getGameAPI();
	
	game->Init();
}

/*
============
FSession::Frame
============
*/
void FSession::Frame( void ) {
	game->Frame();
}